

# 源码部分
# CreateToastNotifier("PowerShellAppId")
# 取出命令行参数
[CmdletBinding()]
    Param(
        [string]$t = '系统通知',
        [string]$d = '123',
        [string]$s = 'Info'

    )
# 引入对应的命令空间类
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\$prodName" -Name "ShowInActionCenter" -Type Dword -Value "1"
# 构造一个NotifyIcon类的对象
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon 
$objNotifyIcon.Icon = ".\game.ico"
# BalloonTipIcon 支持的值有 "Error" "None" "Info" "Warning"
$objNotifyIcon.BalloonTipIcon = $s
$objNotifyIcon.BalloonTipTitle = $t
$objNotifyIcon.BalloonTipText = $d
$objNotifyIcon.Visible = $True 
$objNotifyIcon.ShowBalloonTip(10000)
#通知后自动关闭
$objNotifyIcon.Dispose()


# ps执行脚本
# .\notice.ps1 -t 这是通知标题 -d 这是一条测试通知的详情，请查看 -s None
